//
//  NewsTwoCell.m
//  sensen_ios
//
//  Created by mc on 16/3/25.
//  Copyright © 2016年 pro. All rights reserved.
//

#import "NewsTwoCell.h"

@implementation NewsTwoCell

+(instancetype)cellWithTableView:(UITableView*)tableView{
    
    static NSString * cellIdentifier = @"NewsTwoCell";
    NewsTwoCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell ==nil) {
        cell = [[self alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
    
}

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
        [self setupSubViews];
        
    }
    return self;
}

- (void)setupSubViews{
    
    UILabel * lable = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 30)];
    lable.textColor = [UIColor grayColor];
    lable.text = @"  伦敦水族官迎来年度大扫除 萌鱼围观呆头呆脑";
    lable.font = [UIFont systemFontOfSize:13];
    lable.backgroundColor = rgba(238, 238, 238, 1);
    [self addSubview:lable];
    
    
    UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 100)];
    view.backgroundColor = rgba(238, 238, 238, 1);
    CGFloat width = (SCREEN_WIDTH -25 ) / 3;
    
    for (int i = 0; i < 3; i++) {
        UIImageView * imageView = [[UIImageView alloc] init];
        imageView.image = [UIImage imageNamed:@"新闻中图"];
        [view addSubview:imageView];
        imageView.tag = 100 + i;
        if (i == 0) {
            [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(view).offset(8);
                make.centerY.equalTo(view).offset(0);
                make.size.mas_equalTo(CGSizeMake(width, view.height - 10));
            }];
        }else if (i == 1){
            [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
                
                make.centerX.equalTo(view).offset(0);
                make.centerY.equalTo(view).offset(0);
                make.size.mas_equalTo(CGSizeMake(width, view.height - 10));
                
                
            }];
        }else if (i == 2){
            
            [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.right.equalTo(view).offset(-8);
                make.centerY.equalTo(view).offset(0);
                make.size.mas_equalTo(CGSizeMake(width, view.height - 10));
                
            }];
            
            
        }

    }
}


@end
